using System.Collections;
using NUnit.Framework;

namespace Anvil.Core
{
    [TestFixture]
    public class EntryDictionaryFixture 
    {

        [Test]
        public void ToArrayString()
        {
            string NAME = "Name";
            string ADDRESS = "Address";

            IEntryDictionary entry = new EntryDictionary();
            entry.Set(NAME.ToUpper(),NAME);
            entry.Set(ADDRESS.ToUpper(),ADDRESS);

            string[] rows = entry.ToStringArray();

            Assert.IsTrue(NAME.Equals(rows[0])  || NAME.Equals(rows[1]));
            Assert.IsTrue(ADDRESS.Equals(rows[0]) || ADDRESS.Equals(rows[1]));
            Assert.IsFalse(rows[0].Equals(rows[1]));
        }

        [Test]
        public void ToArrayStringOrdered()
        {
            string NAME = "Name";
            string ADDRESS = "Address";

            IEntryDictionary entry = new EntryDictionary();
            entry.Set(NAME.ToUpper(), NAME);
            entry.Set(ADDRESS.ToUpper(), ADDRESS);

            IList keys = new ArrayList(2);
            keys.Add(NAME.ToUpper());
            keys.Add(ADDRESS.ToUpper());

            string[] rows = entry.ToStringArray(keys);

            Assert.IsTrue(NAME.Equals(rows[0]));
            Assert.IsTrue(ADDRESS.Equals(rows[1]));
        }

    }
}
